#ifndef ABSTRACTCLASS_H
#define ABSTRACTCLASS_H
#include <math.h>
#include <iostream>
using namespace std ;
class Shape;
class Circle;
class Triangle;
class Rectangle;

class Shape
{
    public:
       virtual double getArea() const =0;
       virtual double getPerimeter() const = 0;
};
class Circle :public Shape
{
private:
    /* data */
    double  r;
public:
    Circle(double r);
    ~Circle();
    double getArea() const ;
    double getPerimeter() const;

};

Circle::Circle(double ir)
{
    r=ir;
}
double Circle::getArea()const 
{
    return r*r*3.1415926;
}
double Circle::getPerimeter() const
{
    return 2*3.1415926*r;
}
Circle::~Circle()
{
}
class Rectangle :public Shape
{
private:
    double length;
    double width;
public:
    Rectangle(double ilength,double iwidth);
    ~Rectangle();
    double getArea()const;
    double getPerimeter() const;
};

Rectangle::Rectangle(double ilength,double iwidth)
{
    length=ilength;
    width=iwidth;

}
double Rectangle::getArea()const {
    return width*length;
}
double Rectangle::getPerimeter() const {
    return 2*(width+length);
}
Rectangle::~Rectangle()
{
    
}

class Triangle :public Shape
{
private:
    double a;
    double b;
    double c;
public:
    Triangle(double a ,double b,double c );
    double getArea() const;
    double getPerimeter() const ;
    ~Triangle();
};

double Triangle::getArea() const 
{
    double p =(a+b+c)/2.0;
    // 
    return sqrt(p*(p-a)*(p-b)*(p-c));
}
double Triangle::getPerimeter() const 
{
    return (a+b+c);
}
Triangle::Triangle(double ia ,double ib,double ic )
{
    a=ia;
    b=ib;
    c=ic;
}

Triangle::~Triangle()
{
}
double totalArea(const Shape & a ,const Shape &b)
{
    return a.getArea()+b.getArea();
}

#endif